package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported
/**
 * Controller class for the DVD collection
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * @revised version English (Ab)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class DVDController
{
    private DVDCollection dvdCollection;
    private static DVDController _instance = null;
    
    /**
     * Constructor for objects of class DVDCtr
     */
    private DVDController() //DVD container is to be passed as parameter from the main controller
    {
        dvdCollection = DVDCollection.getInstance();  
    }
    
    public void createDvd(int id, String title, String artist, String releaseDate)
    {
        DVD newDvd = new DVD(id, title,artist,releaseDate);
        dvdCollection.addDvd(newDvd);
    }
    
    public DVD search(String searchTitle)
    {
        return dvdCollection.searchDvd(searchTitle);
    }
    
    public DVD getDvd(int id)
    {
        DVD dvd = dvdCollection.getDvd(id);
        return dvd;
    }
    
    public void editTitle(DVD dvd, String title)
    {
        dvd.setTitle(title);
    }
    
    public void editArtist(DVD dvd, String artist)
    {
        dvd.setArtist(artist);
    }
    
    public void editReleasedate(DVD dvd, String releaseDate)
    {
        dvd.setReleaseDate(releaseDate);
    }
    
    public void editSample(DVD dvd, Sample sample)
    {
        dvd.setSample(sample);
    }
    
    public void removeDvd(DVD dvd)
    {
        dvdCollection.removeDvd(dvd);
    }
}
